<script setup>
import { ref } from 'vue'
import { getCateList } from '@/api/cate'

const channelList = ref([])
const getChannelList = async () => {
  const {
    data: { data }
  } = await getCateList()
  channelList.value = data
}
getChannelList()

const emit = defineEmits(['update:modelValue'])
defineProps({
  modelValue: {
    type: [Number, String]
  },
  name: {
    type: String
  }
})
</script>
<template>
  <el-select
    :modelValue="modelValue"
    @update:modelValue="emit('update:modelValue', $event)"
    :placeholder="`请选择${name}`"
  >
    <el-option
      v-for="list in channelList"
      :key="list.id"
      :label="list.name"
      :value="list.id"
    />
  </el-select>
</template>
<style scoped>
.el-select {
  --el-select-width: 180px;
}
</style>
